package com.mygdx.canyonbunny.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.mygdx.canyonbunny.game.GameRenderer;
import com.mygdx.canyonbunny.game.GameWorld;
import com.mygdx.canyonbunny.util.InputHandler;

public class GameScreen implements Screen {
	private GameWorld gameWorld;
	private GameRenderer gameRenderer;
	private boolean paused;
	private float runTime;

	public GameScreen() {

		float screenWidth = Gdx.graphics.getWidth();
		float screenHeight = Gdx.graphics.getHeight();
		float gameWidth = 136;
		float gameHeight = screenHeight / (screenWidth / gameWidth);

		int midPointY = (int) (gameHeight / 2);

		gameWorld = new GameWorld(midPointY);
		gameRenderer = new GameRenderer(gameWorld, (int) gameHeight, midPointY);
		paused = false;
		Gdx.input.setInputProcessor(new InputHandler(gameWorld));

	}

	@Override
	public void render(float delta) {
		runTime += delta;
		gameWorld.update(delta);
		gameRenderer.render(runTime);

	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub

	}

	@Override
	public void show() {
		// TODO Auto-generated method stub

	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub

	}

	@Override
	public void pause() {
		paused = true;

	}

	@Override
	public void resume() {
		paused = false;

	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

}
